<template>
  <el-table
    :data="tableData"
    style="width: 100%">
    <el-table-column
      prop="createTime"
      label="日期"
      width="180">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="address"
      label="地址">
    </el-table-column>
  </el-table>
</template>

<script>
  //引入外部js文件
  //import usermock from "../../js/userMock"
  //局部导入axios
  //import axios from "axios"
  export default {
    data() {
      return {
        //页面加载完之后，展示数据
        tableData: []
      }
    },
    //以前ajax发送异步请求
    //vue推荐使用axios
    mounted(){
      //发生异步请求axios.poat==this.$http.post
        this.$http.post("/user/list",{"page":1})
          .then(result=>{//请求成功的回调函数
            console.debug(result)
            //this.tableData = result.data.data
            this.tableData = result.data.rows
          })
          .catch(result=>{})
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
